package com.huaxin.hxmoduleworkorder.dto.request;

import com.baomidou.mybatisplus.annotation.TableField;
import com.huaxin.hxenum.validation.ValidUnit;
import com.huaxin.hxmoduleworkorder.common.annotation.validation.ValidCustomerType;
import com.huaxin.hxmoduleworkorder.common.annotation.validation.ValidInspectionOrderItemResultStatus;
import com.huaxin.hxmoduleworkorder.common.annotation.validation.ValidInspectionTemplateItemType;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.util.List;

@Data
public class InspectionOrderItemCreateReqDTO {
    @Schema(description = "所属巡检工单ID，用于关联工单", example = "ins_order_001")
    @NotBlank(message = "所属巡检工单ID不能为空")
    private String inspectionOrderId;

    @Schema(description = "客户类型：commercial/residential", example = "commercial")
    @NotBlank(message = "客户类型不能为空")
    @ValidCustomerType
    private String customerType;

    @Schema(description = "客户ID", example = "cust_001")
    @NotBlank(message = "客户ID不能为空")
    private String customerId;

    @Schema(description = "所属配电房ID", example = "room_001")
    @NotBlank(message = "所属配电房ID不能为空")
    private String roomId;

    @Schema(description = "所属配电箱ID", example = "cus_001")
    @NotBlank(message = "所属配电箱ID不能为空")
    private String cabinetId;

    @Schema(description = "检查项名称，如“电表读数是否正常”", example = "电表读数是否正常")
    @NotBlank(message = "检查项名称不能为空")
    @Size(max = 100, message = "检查项名称长度不能超过100个字符")
    private String name;

    @Schema(description = "类型：check（检查项）/measure（测量项）/photo（拍照项）", example = "photo")
    @NotBlank(message = "检查项类型不能为空")
    @Size(max = 20, message = "检查项类型长度不能超过20个字符")
    @ValidInspectionTemplateItemType
    private String type;

    @Schema(description = "填写提示", example = "请拍摄电表当前读数照片")
    private String inputHint;

    @Schema(description = "单位", example = "V")
    @ValidUnit
    private String unit;

    @Schema(description = "标准值，如“220V±5%”", example = "220V±5%")
    @Size(max = 200, message = "标准值长度不能超过200个字符")
    private String standardValue;

    @Schema(description = "实际值，可为文本或拍照路径", example = "218V")
    @Size(max = 500, message = "实际值长度不能超过500个字符")
    private String actualValue;

    @Schema(description = "检查结果状态：pending（待检查）/normal（正常）/abnormal（异常）", example = "normal")
    @NotBlank(message = "检查结果状态不能为空")
    @ValidInspectionOrderItemResultStatus
    private String resultStatus;

    @Schema(description = "备注或问题描述", example = "电压偏低，建议检查线路")
    @Size(max = 1000, message = "备注长度不能超过1000个字符")
    private String remarks;
    
    @Schema(description = "备注图片URL列表", example = "[\"https://oss/1.jpg\",\"https://oss/2.jpg\"]")
    private String remarkImages;

    @Schema(description = "照片URL列表，用于拍照类检查项", example = "[\"https://oss/1.jpg\",\"https://oss/2.jpg\"]")
    private List<String> photoUrls;

    @Schema(description = "排序序号，用于前端展示顺序", example = "1")
    private Integer sequence;
}